import axios from '@/utils/request'

// 库存明细list
export const getInventoryList = (params) => {
  params.materialName = decodeURI(params.materialName)
  return axios({
    method: 'GET',
    url: '/stock/pageStockDetail',
    params
  })
}

// 导出
export function exportInventory (params) {
  return axios({
    url: '/stock/exportStockDetail',
    method: 'GET',
    params,
    responseType: 'blob'
  })
}

// 下载导入模板
export function downExportInventory () {
  return axios({
    url: '/stock/downloadStockImportTemplate',
    method: 'GET',
    responseType: 'blob'
  })
}
// 导入
export function importInventory (data) {
  return axios({
    url: '/stock/importStock',
    method: 'GET',
    data
  })
}

// 库存盘点
// 分页
export const getInventoryCheckingList = (params) => {
  params.materialName = decodeURI(params.materialName)
  return axios({
    method: 'GET',
    url: '/stockCheck/pageStockCheck',
    params
  })
}
export const totalStockDetailAmount = (params) => {
  return axios({
    method: 'GET',
    url: '/stock/totalStockDetailAmount',
    params
  })
}

// 编辑
export const getInventoryCheckingEdit = (data) => {
  return axios({
    method: 'POST',
    url: '/stockCheck/modifyStockCheck',
    data
  })
}
// 新增
export const getInventoryCheckingAdd = (data) => {
  return axios({
    method: 'POST',
    url: '/stockCheck/addStockCheck',
    data
  })
}
// 删除
export const getInventoryCheckingDelete = (id) => {
  return axios({
    method: 'POST',
    url: '/stockCheck/deleteStockCheck/' + id
  })
}

// 查找材料
export const findByCanCheckMaterail = (params) => {
  return axios({
    method: 'GET',
    url: '/stockCheck/findByCanCheckMaterail',
    params
  })
}
